package com.zhuss.controller.advice;

import com.zhuss.advice.proposal.ProposalOperateServiceExt;
import com.zhuss.bean.bo.advice.proposal.CreateProposalBo;
import com.zhuss.bean.bo.advice.proposal.DeleteProposalBo;
import com.zhuss.bean.bo.advice.proposal.UpdateProposalBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.WpsException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhushanshuo
 * @Date: 2020/3/6 9:40
 */
@RestController
@RequestMapping("/proposal")
public class ProposalOperateController extends BaseController {

    @Autowired
    @Qualifier("proposalOperateService")
    private OperateService<Void, Object> proposalOperateService;

    @Autowired
    @Qualifier("proposalOperateServiceExt")
    private ProposalOperateServiceExt proposalOperateServiceExt;

    /**
     * 新建
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateProposalBo bo) throws WpsException {
        proposalOperateService.create(bo);
    }

    /**
     * 修改
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateProposalBo bo) throws WpsException {
        proposalOperateService.update(bo);
    }

    /**
     * 删除
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteProposalBo bo) throws WpsException {
        proposalOperateService.delete(bo);
    }
}
